<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<%@include file="../../../include/meta.jsp"%>

<title>通用权限管理系统</title>
<%@include file="../../../include/css.jsp"%>
</head>
<body>
	<%@include file="../include/header.jsp"%>
	<nav aria-label="breadcrumb">
		<ol class="breadcrumb">
			<li class="breadcrumb-item"><a
				href="${pageContext.request.contextPath}/app/main.html"><i
					class="fas fa-home"></i>主页</a></li>
			<li class="breadcrumb-item"><a
				href="${pageContext.request.contextPath}/app/user/list.html">用户管理</a></li>
			<li class="breadcrumb-item active" aria-current="page">编辑用户</li>
		</ol>
	</nav>

	<div class="container">
		<div class="row">
			<div class="col-12">
				<form
					action="${pageContext.request.contextPath}/app/user/update.html"
					method="post">
					<input type="hidden" name="id" value="${user.id}"> <input
						type="hidden" name="page" value="${page}"> <input
						type="hidden" name="size" value="${size}">
					<div class="form-group row">
						<label for="">姓名</label> <input type="text" class="form-control"
							id="name" name="name" value="${user.name}"
							aria-describedby="hbName"> <small id="hbName"
							class="form-text text-muted"></small>
					</div>

					<div class="form-group row">
						<label for="">登录名</label> <input type="text" class="form-control"
							id="loginName" name="loginName" value="${user.loginName}"
							aria-describedby="hbLoginName"> <small id="hbLoginName"
							class="form-text text-muted"></small>
					</div>

					<div class="form-group row">
						<label for="">密码</label> <input type="password"
							class="form-control" id="password" name="password"
							value="${user.password}" aria-describedby="hbPassword"> <small
							id="hbPassword" class="form-text text-muted"></small>
					</div>

					<div class="form-group form-check row">
						<input type="checkbox" class="form-check-input" id="disabled"
							name="disabled" ${user.disabled?"checked":""}> <label
							class="form-check-label" for="disabled">禁用</label>
					</div>

					<div class="form-group row">
						<label>用户角色</label>
					</div>

					<div id="" class="form-group row"
						style="padding-left: 20px; border-bottom: 1px solid #ccc;">
						<c:forEach items="${roles}" var="r">
							<div class="form-group form-check col-md-2">
								<input type="checkbox" class="form-check-input" id="c${r.id}"
									name="roles" value="${r.id}" ${r.checked?"checked":""}> <label
									class="form-check-label" for="c${r.id}">${r.name}</label>
							</div>
						</c:forEach>
					</div>

					<div class="form-group row">
						<div class="col-md-4">
							<button type="submit" class="btn btn-primary btn-block">保存</button>
						</div>
						<div class="col-md-3">
							<button type="reset" class="btn btn-warning btn-block">重置</button>
						</div>
						<div class="col-md-2 offset-md-3">
							<a class="btn btn-secondary btn-block"
								href="${pageContext.request.contextPath}/app/user/list.html?page=${page}&size=${size}">返回</a>
						</div>
					</div>
				</form>
				<div id="message" class="lead text-danger" style="margin-top: 10px;">${message}
					<script>
						setTimeout(function() {
							$("#message").text("");
						}, 3000);
					</script>
				</div>
			</div>
		</div>
	</div>

	<%@include file="../../../include/js.jsp"%>

</body>
</html>